import { onMounted } from "vue";
import { Toast } from "vant";
import MJCrequesting from "@/service/index.js";

export default function getGraboffers() {
  const pageIndex = 1;
  const pageSize = 10;

  onMounted(async () => {
    try {
      let data = {
        pageIndex: pageIndex,
        pageSize: pageSize,
      };
      console.log(JSON.stringify(data));
      const result = await MJCrequesting.request({
        url: "/appointmentNeed/findAppointmentNeedDoctorPage",
        method: "POST",
        headers: {
          "Content-Type": "application/json",
        },
        data: JSON.stringify(data),
      });
      if (result.data.msg) {
        Toast.fail(result.data.msg);
        return;
      }

      console.log(result);
    } catch (error) {
      console.log(error);
    }
  });
}
